<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>响应式菜单</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        body {
            font-family: Arial, sans-serif;
        }
        
        /* 导航栏容器 */
        .navbar {
            background-color: #333;
            padding: 10px 20px;
            position: relative;
        }
        
        /* PC端横向菜单样式 */
        .nav-menu {
            display: flex;
            list-style: none;
        }
        
        .nav-menu li {
            margin-right: 20px;
        }
        
        .nav-menu li a {
            color: white;
            text-decoration: none;
            padding: 10px 15px;
            display: block;
        }
        
        .nav-menu li a:hover {
            background-color: #555;
            border-radius: 4px;
        }
        
        /* 移动端菜单按钮 */
        .menu-toggle {
            display: none;
            cursor: pointer;
            color: white;
            font-size: 24px;
            position: absolute;
            right: 20px;
            top: 10px;
        }
        
        /* 移动端菜单样式 */
        .mobile-menu {
            display: none;
            list-style: none;
            background-color: #444;
            width: 100%;
            position: absolute;
            left: 0;
            top: 100%;
            z-index: 1000;
        }
        
        .mobile-menu li a {
            color: white;
            text-decoration: none;
            padding: 12px 20px;
            display: block;
            border-bottom: 1px solid #555;
        }
        
        .mobile-menu li a:hover {
            background-color: #666;
        }
        
        /* 响应式设计 - 当屏幕宽度小于768px时应用移动端样式 */
        @media (max-width: 768px) {
            .nav-menu {
                display: none;
            }
            
            .menu-toggle {
                display: block;
            }
            
            .mobile-menu.active {
                display: block;
            }
        }
    </style>
</head>
<body>
    <nav class="navbar">
        <!-- PC端菜单 -->
        <ul class="nav-menu">
            <li><a href="#">首页</a></li>
            <li><a href="#">产品</a></li>
            <li><a href="#">服务</a></li>
            <li><a href="#">关于我们</a></li>
            <li><a href="#">联系我们</a></li>
        </ul>
        
        <!-- 移动端菜单按钮 -->
        <div class="menu-toggle" id="menuToggle">☰</div>
        
        <!-- 移动端菜单 -->
        <ul class="mobile-menu" id="mobileMenu">
            <li><a href="#">首页</a></li>
            <li><a href="#">产品</a></li>
            <li><a href="#">服务</a></li>
            <li><a href="#">关于我们</a></li>
            <li><a href="#">联系我们</a></li>
        </ul>
    </nav>

    <script>
        // 简单的JavaScript控制菜单显示/隐藏
        document.getElementById('menuToggle').addEventListener('click', function() {
            document.getElementById('mobileMenu').classList.toggle('active');
        });
    </script>
</body>
</html>